package com.jmebananas.renderer.pass;

import java.util.Collections;

import com.jme.renderer.pass.BasicPassManager;
import com.jme.renderer.pass.Pass;
import com.jme.renderer.pass.RenderPass;

/**
 * AdvancedPassManager
 * 
 * @author Glenn Powell
 * 
 */
public class AdvancedPassManager extends BasicPassManager {

	public void compile() {
		for (int i = 0, sSize = passes.size(); i < sSize; ++i) {
			Pass pass = passes.get(i);
			if (pass instanceof RenderPass) {
				RenderPass renderPass = (RenderPass) pass;
				for (int j = 0; j < renderPass.size(); ++j) {
					renderPass.get(j).updateRenderState();
					renderPass.get(j).updateGeometricState(0, true);
				}
			}
		}
		Collections.sort(passes, new PassComparator());
	}

}
